{% extends 'encyclopedia/base.html' %}

{% block title %}{{ camera.title }} - 相机百科{% endblock %}

{% block content %}
    <div class="card mb-4">
        <div class="card-header bg-primary text-white">
            <h1 class="card-title">{{ camera.title }}</h1>
        </div>
        <div class="card-body">
            <div class="row">
                <div class="col-md-4">
                    <div class="list-group">
                        <div class="list-group-item">
                            <strong>品牌</strong>: {{ camera.brand }}
                        </div>
                        <div class="list-group-item">
                            <strong>分类</strong>: <a href="{% url 'encyclopedia:category_detail' camera.category.id %}">{{ camera.category.name }}</a>
                        </div>
                        {% if camera.release_date %}
                        <div class="list-group-item">
                            <strong>发布日期</strong>: {{ camera.release_date|date:"Y年m月d日" }}
                        </div>
                        {% endif %}
                        {% if camera.sensor_type %}
                        <div class="list-group-item">
                            <strong>传感器类型</strong>: {{ camera.sensor_type }}
                        </div>
                        {% endif %}
                        {% if camera.image_resolution %}
                        <div class="list-group-item">
                            <strong>图像分辨率</strong>: {{ camera.image_resolution }}
                        </div>
                        {% endif %}
                        <div class="list-group-item">
                            <strong>创建时间</strong>: {{ camera.created_at|date:"Y年m月d日 H:i:s" }}
                        </div>
                        <div class="list-group-item">
                            <strong>更新时间</strong>: {{ camera.updated_at|date:"Y年m月d日 H:i:s" }}
                        </div>
                    </div>
                </div>
                <div class="col-md-8">
                    <div class="card">
                        <div class="card-header">
                            <h2 class="h5">相机详情</h2>
                        </div>
                        <div class="card-body">
                            <p class="card-text">
                                {{ camera.content|linebreaks }}
                            </p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="card-footer">
            <div class="d-flex justify-content-between">
                <a href="{% url 'encyclopedia:camera_edit' camera.id %}" class="btn btn-secondary">编辑</a>
                <form method="post" action="{% url 'encyclopedia:camera_delete' camera.id %}">
                    {% csrf_token %}
                    <button type="submit" class="btn btn-danger">删除</button>
                </form>
                <a href="{% url 'encyclopedia:camera_list' %}" class="btn btn-primary">返回列表</a>
            </div>
        </div>
    </div>
{% endblock %}